package com.icode.core.model.house;

import com.icode.core.model.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-3-2
 * Time: 上午10:47
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "home_page")
public class HomePage extends AbstractEntity {

    @Column
    private String title;

    @Column
    private String contents;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "home_page_id")
    private List<HomeIntroImage> introductionImg;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "home_page_id")
    private List<HomeInfoImage> infoImg;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "home_page_id")
    private List<HomePartnerImage> partners;

    public HomePage() {
    }

    public HomePage(String title, String contents) {
        this.title = title;
        this.contents = contents;
    }

    public void initHomePage(String title, String contents) {
        this.title = title;
        this.contents = contents;
    }

    public void initImgs(List<HomeIntroImage> introductionImg, List<HomeInfoImage> infoImg, List<HomePartnerImage> partners) {
        this.introductionImg = introductionImg;
        this.infoImg = infoImg;
        this.partners = partners;
    }

    public void initIntroImg(List<HomeIntroImage> introductionImg) {
        this.introductionImg = introductionImg;
    }

    public void initInfoImg(List<HomeInfoImage> infoImg) {
        this.infoImg = infoImg;
    }

    public void initPartnersImg(List<HomePartnerImage> partners) {
        this.partners = partners;
    }

    public String title() {
        return title;
    }

    public String contents() {
        return contents;
    }

    public List<HomeIntroImage> introductionImg() {
        return introductionImg;
    }

    public List<HomeInfoImage> infoImg() {
        return infoImg;
    }

    public List<HomePartnerImage> partners() {
        return partners;
    }
}
